var app = getApp();

var pageData = {
    data: {
        'goosd_class': {  //分类
            'classification': [], //一级分类
            'secondLevel': []     //二级分类
        },
        "search1": {  //搜索
            "type": "search",
            "style": "margin-top:0;margin-left:auto;",
            "content": {"placeholder": "\u8bf7\u8f93\u5165\u641c\u7d22\u5185\u5bb9"},
            "customFeature": {
                "hasQuickTags": true,
                "quickTags": ["\u97e9\u7248", "\u6b27\u7f8e"],
                "searchObject": {
                    "subPageResponse": "inner-link",
                    "subFuntionResponse": "call",
                    "style": {
                        "background-color": "rgb(243, 243, 243)",
                        "background-image": "",
                        "margin-top": "3px",
                        "opacity": 1,
                        "color": "rgb(102, 102, 102)",
                        "font-size": "14px"
                    },
                    "content": "",
                    "customFeature": {
                        "lineBackgroundColor": "rgb(255, 255, 255)",
                        "lineBackgroundImage": "",
                        "margin": 0,
                        "lineHeight": "200",
                        "imgWidth": "140",
                        "imgHeight": "140",
                        "vesselAutoheight": 1,
                        "height": "300px",
                        "form": "goods",
                        "mode": 1,
                        "name": "\u5546\u54c1\u5217\u8868",
                        "ifUseContact": true,
                        "isIntegral": false,
                        "isShoppingCart": true,
                        "id": "list-540523487823"
                    },
                    "animations": [],
                    "type": "goods-list",
                    "name": "\u5546\u54c1\u5217\u8868",
                    "id": "zhichi_1428879701"
                }
            },
            "animations": [],
            "page_form": "",
            "compId": "search1",
            "parentCompid": "search1"
        },
        "has_tabbar": 1,
        "page_hidden": true,
        "page_form": "",
        "top_nav": {
            "navigationBarBackgroundColor": "#000000",
            "navigationBarTextStyle": "white",
            "navigationBarTitleText": "\u8d2d\u7269"
        }
    },
    need_login: false,
    page_router: 'page10001',
    page_form: 'none',
    list_compids_params: [],
    user_center_compids_params: [],
    goods_compids_params: [],
    prevPage: 0,
    tostoreComps: [],
    carouselGroupidsParams: [],
    relobj_auto: [{
        "obj_rel": "lFgbBf00l5_view",
        "auto_add_count": true,
        "compid": "data.content[5]",
        "parentcompid": "free_vessel3",
        "has_counted": 0
    }, {
        "obj_rel": "lFgbBf00l5_view",
        "auto_add_count": true,
        "compid": "data.content[6]",
        "parentcompid": "free_vessel3",
        "has_counted": 0
    }],
    bbsCompIds: [],
    dynamicVesselComps: [],
    communityComps: [],
    franchiseeComps: [],
    cityLocationComps: [],
    seckillOnLoadCompidParam: [],
    dynamicClassifyGroupidsParams: [],
    videoListComps: [],
    videoProjectComps: [],
    newsComps: [],
    returnToVersionFlag: true,
    requesting: false,
    requestNum: 1,
    modelChoose: [],
    modelChooseId: '',
    modelChooseName: [],
    goods_class:[],

    goods_classfun: function () {  // 渲染分类
        var url = app.globalData.HOST + app.APILIST.getgoodsclass;
        var data = {"data": {"level": ""}}
        app.WxRequest(url,data,1,
            (res)=>{
             this.goods_class=res.data;
            this.setData({
                goosd_class:{
                    classification:res.data,
                    secondLevel: res.data[0].parent_class
             },
        });
            if (app.globalData.classificationId != 0) {
              this.goods_ang(app.globalData.classificationId);
            }
    },( ref )=>{
        });
    },
    goods_classification: function(e){  // 点击渲染二级分类
        var arr = []
        this.goods_class.forEach((item)=>{
            item.picture = '';
            if(e.currentTarget.id == item.id){
                arr.push(item);
                item.picture = 'goods_class';
            }
        })

        this.data.goosd_class.secondLevel = arr[0].parent_class
        var goosd_class = this.data.goosd_class;
         this.setData({
             goosd_class
         });

    },
    searchGoodsType: function(e){  //点击二级分类进入商品详情页
      // console.log(e.currentTarget.id)
        app.turnToSearchPage(e);
    },
    turnToSearchPage: function (e) {//进入 搜索页
  
        app.turnToSearchPage(e);
     
    },
    onLoad: function (e) {
        app.onPageLoad(e);
        // this.goods_class();
    },
    dataInitial: function () {
        app.pageDataInitial();
    },
    onShareAppMessage: function (e) {
        return app.onPageShareAppMessage(e);
    },
    onShow: function () {
      this.goods_classfun();

   
    },
    goods_ang(e) {  // 从首页点击进来
      var arr = [];
      app.globalData.classificationId = 0;
      this.goods_class.forEach((item) => {
        item.picture = '';
        if (e == item.id) {
          arr.push(item);
          item.picture = 'goods_class';
        }
      })
      this.data.goosd_class.secondLevel = arr[0].parent_class
      var goosd_class = this.data.goosd_class;
      this.setData({
        goosd_class
      });
    },

    reachBottomFuc: [],
    onReachBottom: function () {
        app.onPageReachBottom(this.reachBottomFuc);
    },
    onUnload: function () {
        app.onPageUnload();
    },
    tapPrevewPictureHandler: function (e) {
        app.tapPrevewPictureHandler(e);
    },
    suspensionBottom: function () {
        app.suspensionBottom();
    },
    pageScrollFunc: function (e) {
        app.pageScrollFunc(e);
    },
    dynamicVesselScrollFunc: function (e) {
        app.dynamicVesselScrollFunc(e);
    },
    goodsScrollFunc: function (e) {
        app.goodsScrollFunc(e);
    },
    takeoutStyleScrollFunc: function (e) {
        app.takeoutStyleScrollFunc(e);
    },
    franchiseeScrollFunc: function (e) {
        app.franchiseeScrollFunc(e);
    },
    seckillScrollFunc: function (e) {
        app.seckillScrollFunc(e);
    },
    videoScrollFunc: function (e) {
        app.videoScrollFunc(e);
    },
    carouselVideoClose: function (e) {
        app.carouselVideoClose(e);
    },
    changeCount: function (e) {
        app.changeCount(e);
    },
    inputChange: function (e) {
        app.inputChange(e);
    },
    bindDateChange: function (e) {
        app.bindDateChange(e);
    },
    bindTimeChange: function (e) {
        app.bindTimeChange(e);
    },
    bindSelectChange: function (e) {
        app.bindSelectChange(e);
    },
    bindScoreChange: function (e) {
        app.bindScoreChange(e);
    },
    submitForm: function (e) {
        app.submitForm(e);
    },
    udpateVideoSrc: function (e) {
        app.udpateVideoSrc(e);
    },
    tapMapDetail: function (e) {
        app.tapMapDetail(e);
    },
    uploadFormImg: function (e) {
        app.uploadFormImg(e);
    },
    deleteUploadImg: function (e) {
        app.deleteUploadImg(e);
    },
    listVesselTurnToPage: function (e) {
        app.listVesselTurnToPage(e);
    },
    dynamicVesselTurnToPage: function (e) {
        app.dynamicVesselTurnToPage(e);
    },
    userCenterTurnToPage: function (e) {
        app.userCenterTurnToPage(e);
    },
    turnToGoodsDetail: function (e) {
        app.turnToGoodsDetail(e);
    },
    turnToFranchiseeDetail: function (e) {
        app.turnToFranchiseeDetail(e);
    },
    turnToSeckillDetail: function (e) {
        app.turnToSeckillDetail(e);
    },
    sortListFunc: function (e) {
        app.sortListFunc(e);
    },
    bbsInputComment: function (e) {
        app.bbsInputComment(e);
    },
    bbsInputReply: function (e) {
        app.bbsInputReply(e);
    },
    uploadBbsCommentImage: function (e) {
        app.uploadBbsCommentImage(e);
    },
    uploadBbsReplyImage: function (e) {
        app.uploadBbsReplyImage(e);
    },
    deleteCommentImage: function (e) {
        app.deleteCommentImage(e);
    },
    deleteReplyImage: function (e) {
        app.deleteReplyImage(e);
    },
    bbsPublishComment: function (e) {
        app.bbsPublishComment(e);
    },
    clickBbsReplyBtn: function (e) {
        app.clickBbsReplyBtn(e);
    },
    bbsPublishReply: function (e) {
        app.bbsPublishReply(e);
    },
    searchList: function (e) {
        app.searchList(e);

    },
    selectLocal: function (e) {
        app.selectLocal(e);
    },
    cancelCity: function (e) {
        app.cancelCity(e);
    },
    bindCityChange: function (e) {
        app.bindCityChange(e);
    },
    submitCity: function (e) {
        app.submitCity(e);
    },
    openTakeoutLocation: function (e) {
        app.openTakeoutLocation(e);
    },
    callTakeout: function (e) {
        app.callTakeout(e);
    },
    getMoreAssess: function (e) {
        app.getMoreAssess(e);
    },
    changeEvaluate: function (e) {
        app.changeEvaluate(e)
    },
    deleteAllCarts: function (e) {
        app.deleteAllCarts(e);
    },
    clickCategory: function (e) {
        app.clickCategory(e);
    },
    goodsListMinus: function (e) {
        app.goodsListMinus(e);
    },
    goodsListPlus: function (e) {
        app.goodsListPlus(e);
    },
    cartListMinus: function (e) {
        app.cartListMinus(e);
    },
    cartListPlus: function (e) {
        app.cartListPlus(e);
    },
    changeAssessType: function (e) {
        app.changeAssessType(e);
    },
    showShoppingCartPop: function (e) {
        app.showShoppingCartPop(e);
    },
    hideShoppingCart: function (e) {
        app.hideShoppingCart(e);
    },
    showGoodsDetail: function (e) {
        app.showGoodsDetail(e);
    },
    hideDetailPop: function (e) {
        app.hideDetailPop(e);
    },
    hideModelPop: function (e) {
        app.hideModelPop(e);
    },
    chooseModel: function (e) {
        app.chooseModel(e);
    },
    sureChooseModel: function (e) {
        app.sureChooseModel(e);
    },
    clickChooseComplete: function (e) {
        app.clickChooseComplete(e);
    },
    reLocalAddress: function (e) {
        app.reLocalAddress(e);
    },
    tapGoodsTradeHandler: function (e) {
        app.tapGoodsTradeHandler(e);
    },
    tapVideoHandler: function (e) {
        app.tapVideoHandler(e);
    },
    tapVideoPlayHandler: function (e) {
        app.tapVideoPlayHandler(e);
    },
    tapVideoHandler: function (e) {
        app.tapVideoHandler(e);
    },
    tapInnerLinkHandler: function (e) {
        app.tapInnerLinkHandler(e);
    },
    tapPhoneCallHandler: function (e) {
        app.tapPhoneCallHandler(e);
    },
    tapRefreshListHandler: function (e) {
        app.tapRefreshListHandler(e);
    },
    tapGetCouponHandler: function (e) {
        app.tapGetCouponHandler(e);
    },
    tapCommunityHandler: function (e) {
        app.tapCommunityHandler(e);
    },
    tapPageShareHandler: function (e) {
        app.tapPageShareHandler(e);
    },
    turnToCommunityPage: function (e) {
        app.turnToCommunityPage(e);
    },
    tapToFranchiseeHandler: function (e) {
        app.tapToFranchiseeHandler(e);
    },
    tapToTransferPageHandler: function () {
        app.tapToTransferPageHandler();
    },
    tapToSeckillHandler: function (e) {
        app.tapToSeckillHandler(e);
    },
    tapToPromotionHandler: function () {
        app.tapToPromotionHandler();
    },
    tapToCouponReceiveListHandler: function () {
        app.tapToCouponReceiveListHandler();
    },
    tapToRechargeHandler: function () {
        app.tapToRechargeHandler();
    },
    tapToXcx: function (e) {
        app.tapToXcx(e);
    },
    tapFranchiseeLocation: function (e) {
        app.tapFranchiseeLocation(e);
    },
    showAddShoppingcart: function (e) {
        app.showAddShoppingcart(e);
    },
    hideAddShoppingcart: function () {
        app.hideAddShoppingcart();
    },
    selectGoodsSubModel: function (e) {
        app.selectGoodsSubModel(e);
    },
    resetSelectCountPrice: function () {
        app.resetSelectCountPrice();
    },
    // 电商
    clickGoodsMinusButton: function (e) {
        app.clickGoodsMinusButton();
    },
    clickGoodsPlusButton: function (e) {
        app.clickGoodsPlusButton();
    },
    sureAddToShoppingCart: function () {
        app.sureAddToShoppingCart();
    },
    sureAddToBuyNow: function () {
        app.sureAddToBuyNow();
    },
    clickTostoreMinusButton: function (e) {
        app.clickTostoreMinusButton(e);
    },
    clickTostorePlusButton: function (e) {
        app.clickTostorePlusButton(e);
    },
    readyToPay: function () {
        app.readyToTostorePay();
    },
    getValidateTostore: function () {
        app.getValidateTostore();
    },
    goToShoppingCart: function () {
        app.goToShoppingCart();
    },
    getCartList: function () {
        app.getTostoreCartList();
    },
    stopPropagation: function () {
    },

    previewImage: function (e) {
        var dataset = e.currentTarget.dataset;
        app.previewImage({
            current: dataset.src,
            urls: dataset.previewImgarr,
        });
    },
    scrollPageTop: function () {
        app.pageScrollTo(0);
    },
    suspensionTurnToPage: function (e) {
        app.suspensionTurnToPage(e);
    },
    tapToLuckyWheel: function (e) {
        app.tapToLuckyWheel(e);
    },
    tapToGoldenEggs: function (e) {
        app.tapToGoldenEggs(e);
    },
    tapToScratchCard: function (e) {
        app.tapToScratchCard(e);
    },
    tapToLuckyWheel: function (e) {
        app.tapToLuckyWheel(e);
    },
    keywordList: {},
    bindSearchTextChange: function (e) {
        // this.keywordList[e.currentTarget .dataset.compid] = e.detail.value;
    },
    // 文字组件跳到地图
    textToMap: function (e) {
        app.textToMap(e);
    },
    tapDynamicClassifyFunc: function (e) {
        app.tapDynamicClassifyFunc(e);
    },
    // 跳转到视频详情
    turnToVideoDetail: function (e) {
        app.turnToVideoDetail(e);
    },
    // 单个视频组件播放视频
    startPlayVideo: function (e) {
        app.startPlayVideo(e);
    },
    // 视频播放报错
    videoError: function (e) {
        app.showModal({
            content: e.detail.errMsg
        });
    },
    // 视频项目播放事件
    videoProjectPlay: function (e) {
        app.videoProjectPlay(e);
    },
    // 视频项目暂停事件
    videoProjectPause: function (e) {
        app.videoProjectPause(e);
    },
    // 跳转到资讯详情
    turnToNewsDetail: function (e) {
        app.turnToNewsDetail(e)
    },
    //切换资讯分类
    getNewsCateList: function (e) {
        app.getNewsCateList(e);
    },
};
Page(pageData);
